package topcoder.srm573;

import java.util.Arrays;

public class SkiResortsEasy {
	public int minCost(int[] alt)
	{
		int cost = 0;
		for(int i = 0; i< alt.length -1; i++) {
			if(alt[i] < alt[i+1]) {
				cost += alt[i+1] - alt[i];
				alt[i+1] = alt[i];
			}
		}
		System.out.println(Arrays.toString(alt));
		return cost;
	}
	
	public static void main(String[] args) {
		SkiResortsEasy sre = new SkiResortsEasy();
		int[] alt = {2, 2, 1, 1, 3, 1, 3, 2, 1, 3, 1, 2, 1, 2, 1};
		System.out.println(sre.minCost(alt));
	}

}
